// addOrganizationToolsApplys
exports.addOrganizationToolsApplys = function (req, res) {

    //获取参数
    var bodyParams = req.routeInfo.bodyParams;
    //最终结果
    var resultData = {};

    //任务流创建
    async.waterfall([
            //1.查询浏览记录
            function (cb) {
                R.SEND_HTTP(
                    req,
                    {
                        url: CORE_APIConfig.coreAPI.addOrganizationToolsApply,
                        method: 'POST',
                        data: {
							ota_name : bodyParams.ota_name,
							ota_type : bodyParams.ota_type,
							ota_member : bodyParams.ota_member,
							ota_phone : bodyParams.ota_phone,
							ota_address : bodyParams.ota_address,
							ota_block : bodyParams.ota_block,
                        }
                    },
                    function (err, data) {
                        console.log(data);
                        console.log(err);
                        //判断是否有错误信息
                        if (err) {
                            return cb(err, data);
                        }
                        cb();
                    }
                );
            },

            function (cb) {
                R.SEND_HTTP(
                    req,
                    {
                        url: "http://manage.hxzbi.com:3500/weixin/templateMessagesSent",
//                      url: "http://127.0.0.1:3500/weixin/templateMessagesSent",
                        method: 'POST',
                        data: {
							"type": "shiYongShenQing",
							"openid": "oNriK0a6gZiAXJjGNWAqFe4eTydg",
//							"openid": "oNriK0ZfubRWB63q63np_hobc1G0",
							"name": bodyParams.ota_name,
							"tel": bodyParams.ota_phone,
							"goUrls": "http://manage.hxzbi.com/#/freeapplyList"
						}
                    },
                    function (err, data) {
                        //判断是否有错误信息
                        if (err) {
                            return RES.response(res, false, data);
                        }
                        cb();
                    }
                );
            }
        ], function (err, result) {

            //返回最终拼接结果
            RES.response(res, true, resultData);

        }
    );

}